package com.fuang;

/**
 * Created by Fuang on 2018-1-26.
 */
public class MyPrinter {
    private static class MyPrinterHolder {
        private static MyPrinter instance = new MyPrinter();
    }
    private MyPrinter(){
        System.out.println("implements3: created a MyPrint instance.");
    }
    public static  MyPrinter getInsatnce() {
        return MyPrinterHolder.instance;
    }

    public static void testPrint(){
        System.out.println("hello!");
    }

    public void print(String str){
        System.out.println(str);
    }

    public static void main(String[] args) {
        MyPrinter p = MyPrinter.getInsatnce();
        p.print("hello world.");
        MyPrinter.testPrint();
    }

}
